1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.ActionBar; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Widget; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * `GtkActionBar` is designed to present contextual actions. 36 * 37 *  38 * 39 * It is expected to be displayed below the content and expand 40 * horizontally to fill the area. 41 * 42 * It allows placing children at the start or the end. In addition, it 43 * contains an internal centered box which is centered with respect to 44 * the full width of the box, even if the children at either side take 45 * up different amounts of space. 46 * 47 * # CSS nodes 48 * 49 * ``` 50 * actionbar 51 * ╰── revealer 52 * ╰── box 53 * ├── box.start 54 * │ ╰── [start children] 55 * ├── [center widget] 56 * ╰── box.end 57 * ╰── [end children] 58 * ``` 59 * 60 * A `GtkActionBar`'s CSS node is called `actionbar`. It contains a `revealer` 61 * subnode, which contains a `box` subnode, which contains two `box` subnodes at 62 * the start and end of the action bar, with `start` and `end style classes 63 * respectively, as well as a center node that represents the center child. 64 * 65 * Each of the boxes contains children packed for that side. 66 */ 67 public class ActionBar : Widget 68 { 69 /** the main Gtk struct */ 70 protected GtkActionBar* gtkActionBar; 71 72 /** Get the main Gtk struct */ 73 public GtkActionBar* getActionBarStruct(bool transferOwnership = false) 74 { 75 if (transferOwnership) 76 ownedRef = false; 77 return gtkActionBar; 78 } 79 80 /** the main Gtk struct as a void* */ 81 protected override void* getStruct() 82 { 83 return cast(void*)gtkActionBar; 84 } 85 86 /** 87 * Sets our main struct and passes it to the parent class. 88 */ 89 public this (GtkActionBar* gtkActionBar, bool ownedRef = false) 90 { 91 this.gtkActionBar = gtkActionBar; 92 super(cast(GtkWidget*)gtkActionBar, ownedRef); 93 } 94 95 96 /** */ 97 public static GType getType() 98 { 99 return gtk_action_bar_get_type(); 100 } 101 102 /** 103 * Creates a new `GtkActionBar` widget. 104 * 105 * Returns: a new `GtkActionBar` 106 * 107 * Throws: ConstructionException GTK+ fails to create the object. 108 */ 109 public this() 110 { 111 auto __p = gtk_action_bar_new(); 112 113 if(__p is null) 114 { 115 throw new ConstructionException("null returned by new"); 116 } 117 118 this(cast(GtkActionBar*) __p); 119 } 120 121 /** 122 * Retrieves the center bar widget of the bar. 123 * 124 * Returns: the center `GtkWidget` 125 */ 126 public Widget getCenterWidget() 127 { 128 auto __p = gtk_action_bar_get_center_widget(gtkActionBar); 129 130 if(__p is null) 131 { 132 return null; 133 } 134 135 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 136 } 137 138 /** 139 * Gets whether the contents of the action bar are revealed. 140 * 141 * Returns: the current value of the [property@Gtk.ActionBar:revealed] 142 * property 143 */ 144 public bool getRevealed() 145 { 146 return gtk_action_bar_get_revealed(gtkActionBar) != 0; 147 } 148 149 /** 150 * Adds @child to @action_bar, packed with reference to the 151 * end of the @action_bar. 152 * 153 * Params: 154 * child = the `GtkWidget` to be added to @action_bar 155 */ 156 public void packEnd(Widget child) 157 { 158 gtk_action_bar_pack_end(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 159 } 160 161 /** 162 * Adds @child to @action_bar, packed with reference to the 163 * start of the @action_bar. 164 * 165 * Params: 166 * child = the `GtkWidget` to be added to @action_bar 167 */ 168 public void packStart(Widget child) 169 { 170 gtk_action_bar_pack_start(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 171 } 172 173 /** 174 * Removes a child from @action_bar. 175 * 176 * Params: 177 * child = the `GtkWidget` to be removed 178 */ 179 public void remove(Widget child) 180 { 181 gtk_action_bar_remove(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 182 } 183 184 /** 185 * Sets the center widget for the `GtkActionBar`. 186 * 187 * Params: 188 * centerWidget = a widget to use for the center 189 */ 190 public void setCenterWidget(Widget centerWidget) 191 { 192 gtk_action_bar_set_center_widget(gtkActionBar, (centerWidget is null) ? null : centerWidget.getWidgetStruct()); 193 } 194 195 /** 196 * Reveals or conceals the content of the action bar. 197 * 198 * Note: this does not show or hide @action_bar in the 199 * [property@Gtk.Widget:visible] sense, so revealing has 200 * no effect if the action bar is hidden. 201 * 202 * Params: 203 * revealed = The new value of the property 204 */ 205 public void setRevealed(bool revealed) 206 { 207 gtk_action_bar_set_revealed(gtkActionBar, revealed); 208 } 209 }